import { Controller, Get, Param } from '@nestjs/common';
import { ApiBearerAuth, ApiOperation, ApiTags } from '@nestjs/swagger';
import { ModuleSwaggerTags } from '~/constants/modules.constant';
import { Public } from '~/modules/auth/decorators/public.decorator';
import { KnowledgeEntity } from '~/modules/knowledge/knowledge.entity';
import { KnowledgeService } from '~/modules/knowledge/knowledge.service';

@ApiTags(ModuleSwaggerTags.KNOWLEDGE)
@ApiBearerAuth()
@Controller('knowledge')
export class MiniappKnowledgeController {
  constructor(private readonly knowledgeService: KnowledgeService) {}

	@Public()
  @Get('category/:categoryId')
  @ApiOperation({ summary: '根据分类ID获取知识内容' })
  findByCategoryId(@Param('categoryId') categoryId: number): Promise<KnowledgeEntity[]> {
    return this.knowledgeService.findByCategoryId(categoryId);
  }
}